cmake_minimum_required(VERSION 3.10)

# Remove when sharing with others.
list(APPEND CMAKE_PREFIX_PATH "C:/Qt/Tools/QtCreator")

project(qtc_astyle)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_STANDARD 17)

find_package(QtCreator REQUIRED COMPONENTS Core)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
set(QtX Qt${QT_VERSION_MAJOR})

add_subdirectory(artisticstyle)

add_qtc_plugin(qtc_astyle
  PLUGIN_DEPENDS
    QtCreator::Core
    QtCreator::QtSupport
    QtCreator::TextEditor
    QtCreator::DiffEditor
    QtCreator::ProjectExplorer
    QtCreator::QmakeProjectManager
  DEPENDS
    ${QtX}::Widgets
    QtCreator::ExtensionSystem
    QtCreator::Utils
  SOURCES
    qtc_astyle.cpp
    qtc_astyle.h
    qtc_astyleconstants.h
    astyle.qrc
    astyleactions.cpp
    astyleactions.h
    cartisticstyle.cpp
    cartisticstyle.h
    cdlgformatproject.cpp
    cdlgformatproject.h
    cdlgformatproject.ui
    cformatprojectthread.cpp
    cformatprojectthread.h
    formformatoption.cpp
    formformatoption.h
    formformat.ui
    formindentoption.cpp
    formindentoption.h
    formindent.ui
    formpadoption.cpp
    formpadoption.h
    formpad.ui
    formstyleoption.cpp
    formstyleoption.h
    formstyle.ui
    formtaboption.cpp
    formtaboption.h
    formtab.ui
    valueaction.cpp
    valueaction.h
)

target_link_libraries(qtc_astyle PUBLIC AStyleLib)

target_link_directories(qtc_astyle PUBLIC
                       "${PROJECT_BINARY_DIR}/artisticstyle"
                       )

target_include_directories(qtc_astyle PUBLIC
                          "${PROJECT_SOURCE_DIR}/artisticstyle"
                          )
